home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
AIncludes
/
Serial.a
< prev
next >
Wrap
Text File
|
1996-05-01
|
7KB
|
177 lines
;
; File: Serial.a
;
; Contains: Asynchronous Serial Driver (.AIn/.AOut/.BIn/.BOut) Interfaces
;
; Version: Technology: System 7.5.2
; Release: Universal Interfaces 3.0d3 on Copland DR1
;
; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
;
; Bugs?: If you find a problem with this file, send the file and version
; information (from above) and the problem description to:
;
; Internet: apple.bugs@applelink.apple.com
; AppleLink: APPLE.BUGS
;
;
IF &TYPE('__SERIAL__') = 'UNDEFINED' THEN
__SERIAL__ SET 1
IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
include 'Types.a'
ENDIF
baud150 EQU 763
baud300 EQU 380
baud600 EQU 189
baud1200 EQU 94
baud1800 EQU 62
baud2400 EQU 46
baud3600 EQU 30
baud4800 EQU 22
baud7200 EQU 14
baud9600 EQU 10
baud14400 EQU 6
baud19200 EQU 4
baud28800 EQU 2
baud38400 EQU 1
baud57600 EQU 0
stop10 EQU 16384
stop15 EQU -32768
stop20 EQU -16384
noParity EQU 0
oddParity EQU 4096
evenParity EQU 12288
data5 EQU 0
data6 EQU 2048
data7 EQU 1024
data8 EQU 3072
aData EQU 6 ; channel A data in or out (historical)
aCtl EQU 2 ; channel A control (historical)
bData EQU 4 ; channel B data in or out (historical)
bCtl EQU 0 ; channel B control (historical)
ctsEvent EQU 32 ; flag for SerShk.errs and SerShk.evts
breakEvent EQU 128 ; flag for SerShk.errs and SerShk.evts
xOffWasSent EQU 128 ; flag for SerStaRec.xOffSent
dtrNegated EQU 64 ; flag for SerStaRec.xOffSent
ainRefNum EQU -6 ; serial port A input
aoutRefNum EQU -7 ; serial port A output
binRefNum EQU -8 ; serial port B input
boutRefNum EQU -9 ; serial port B output
swOverrunErr EQU 1 ; serial driver error masks
breakErr EQU 8 ; serial driver error masks
parityErr EQU 16 ; serial driver error masks
hwOverrunErr EQU 32 ; serial driver error masks
framingErr EQU 64 ; serial driver error masks
kOptionClockX1CTS EQU 64 ; option bit used with Control code 16
kOptionPreserveDTR EQU 128 ; option bit used with Control code 16
sPortA EQU 0
sPortB EQU 1
; typedef SInt8 SPortSel
; csCodes for serial driver Control routines
kSERDConfiguration EQU 8 ; program port speed, bits/char, parity, and stop bits
kSERDInputBuffer EQU 9 ; set buffer for chars received with no read pending
kSERDSerHShake EQU 10 ; equivalent to SerHShake, largely obsolete
kSERDClearBreak EQU 11 ; assert break signal on output
kSERDSetBreak EQU 12 ; negate break state on output
kSERDBaudRate EQU 13 ; set explicit baud rate, other settings unchanged
kSERDHandshake EQU 14 ; superset of 10, honors setting of fDTR
kSERDClockMIDI EQU 15 ; clock externally on CTS with specified multiplier
kSERDMiscOptions EQU 16 ; select clock source and DTR behavior on close
kSERDAssertDTR EQU 17 ; assert DTR output
kSERDNegateDTR EQU 18 ; negate DTR output
kSERDSetPEChar EQU 19 ; select char to replace chars with invalid parity
kSERDSetPEAltChar EQU 20 ; select char to replace char that replaces chars with invalid parity
kSERDSetXOffFlag EQU 21 ; set XOff output flow control (same as receiving XOff)
kSERDClearXOffFlag EQU 22 ; clear XOff output flow control (same as receiving XOn)
kSERDSendXOn EQU 23 ; send XOn if input flow control state is XOff
kSERDSendXOnOut EQU 24 ; send XOn regardless of input flow control state
kSERDSendXOff EQU 25 ; send XOff if input flow control state is XOn
kSERDSendXOffOut EQU 26 ; send XOff regardless of input flow control state
kSERDResetChannel EQU 27 ; reset serial I/O channel hardware
kSERD115KBaud EQU 115 ; set 115.2K baud data rate (some driver versions)
kSERD230KBaud EQU 230 ; set 230.4K baud data rate (some driver versions)
; csCodes for serial driver Status routines
kSERDInputCount EQU 2 ; return characters available (SerGetBuf)
kSERDStatus EQU 8 ; return characters available (SerStatus)
kSERDVersion EQU 9 ; return version number in first byte of csParam
SerShk RECORD 0
fXOn ds.b 1 ; offset: $0 (0) ; XOn flow control enabled flag
fCTS ds.b 1 ; offset: $1 (1) ; CTS flow control enabled flag
xOn ds.b 1 ; offset: $2 (2) ; XOn character
xOff ds.b 1 ; offset: $3 (3) ; XOff character
errs ds.b 1 ; offset: $4 (4) ; errors mask bits
evts ds.b 1 ; offset: $5 (5) ; event enable mask bits
fInX ds.b 1 ; offset: $6 (6) ; Input flow control enabled flag
fDTR ds.b 1 ; offset: $7 (7) ; DTR input flow control flag
sizeof EQU * ; size: $8 (8)
ENDR
SerStaRec RECORD 0
cumErrs ds.b 1 ; offset: $0 (0) ; errors accumulated since last SerStatus() call
xOffSent ds.b 1 ; offset: $1 (1) ; input (requested to be) held off by xOffWasSent or dtrNegated
rdPend ds.b 1 ; offset: $2 (2) ; incomplete read pending in I/O queue
wrPend ds.b 1 ; offset: $3 (3) ; incomplete write pending in I/O queue
ctsHold ds.b 1 ; offset: $4 (4) ; transmit disabled by hardware handshaking
xOffHold ds.b 1 ; offset: $5 (5) ; transmit disabled by XOn/XOff handshaking
sizeof EQU * ; size: $6 (6)
ENDR
IF FOR_SYSTEM7_ONLY THEN
;
; pascal OSErr SerReset(short refNum, short serConfig)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION SerReset
ENDIF
;
; pascal OSErr SerSetBuf(short refNum, Ptr serBPtr, short serBLen)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION SerSetBuf
ENDIF
;
; pascal OSErr SerHShake(short refNum, const SerShk *flags)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION SerHShake
ENDIF
;
; pascal OSErr SerSetBrk(short refNum)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION SerSetBrk
ENDIF
;
; pascal OSErr SerClrBrk(short refNum)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION SerClrBrk
ENDIF
;
; pascal OSErr SerGetBuf(short refNum, long *count)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION SerGetBuf
ENDIF
;
; pascal OSErr SerStatus(short refNum, SerStaRec *serSta)
;
IF GENERATINGCFM THEN
IMPORT_CFM_FUNCTION SerStatus
ENDIF
ENDIF
ENDIF ; __SERIAL__